﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="DetailOrder.aspx.cs" Inherits="UdrinkWater_Project.Admin.DetailOrder" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:SqlDataSource ID="SqlOrderWCustomerID" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        
        
        
        
    
        SelectCommand="SELECT TB_Order.Order_Date, TB_Order.Shipped_date, TB_Order.Customer_ID, TB_Order.Delivery_Address, TB_Employee.Prefix + ' ' + TB_Employee.Firstname + ' ' + TB_Employee.Lastname AS EmpName, TB_District.DISTRICT_NAME, TB_Aumphur.AMPHUR_NAME, TB_Province.PROVINCE_NAME, TB_Order.Zipcode, TB_Status_Buy.Status_BuyName, TB_StatusUnpaid.Unpaid_Name FROM TB_Order LEFT OUTER JOIN TB_Aumphur ON TB_Order.Aumphur_ID = TB_Aumphur.AMPHUR_ID LEFT OUTER JOIN TB_District ON TB_Order.District_ID = TB_District.DISTRICT_ID LEFT OUTER JOIN TB_Province ON TB_Order.Province_ID = TB_Province.PROVINCE_ID LEFT OUTER JOIN TB_StatusUnpaid ON TB_Order.Status_Unpaid = TB_StatusUnpaid.Unpaid_ID LEFT OUTER JOIN TB_Employee ON TB_Order.Employee_ID = TB_Employee.ID_Card LEFT OUTER JOIN TB_Status_Buy ON TB_Order.Status_Buy = TB_Status_Buy.StatusBuy_ID">
    </asp:SqlDataSource>
    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" 
        HeaderText="รายการสั่งซื้อทั้งหมด" Width="100%">
        <HeaderStyle Font-Size="Large" />
        <PanelCollection>
            <dx:PanelContent runat="server" SupportsDisabledAttribute="True">
                <asp:Panel ID="Panel1" runat="server">
                </asp:Panel>
                <asp:Panel ID="Panel2" runat="server">
                    <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
                        DataSourceID="SqlOrderWCustomerID" KeyFieldName="Order_Date" Width="100%" 
                        OnRowCommand="ASPxGridView1_RowCommand">
                        <Columns>
                              <dx:GridViewCommandColumn ShowInCustomizationForm="True" VisibleIndex="0">
                                  <ClearFilterButton Visible="True">
                                  </ClearFilterButton>
                              </dx:GridViewCommandColumn>
                              <dx:GridViewDataTextColumn Caption="รายการ" FieldName="Number" 
                                                ShowInCustomizationForm="True" UnboundType="String" 
                                  VisibleIndex="1">
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                                <Settings AllowAutoFilter="False" />
                                                <DataItemTemplate>
                                                    <%#Container.ItemIndex +1 %>
                                                </DataItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" />
                                                <CellStyle HorizontalAlign="Center">
                                                </CellStyle>
                                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="รหัส/ชื่อลูกค้า" FieldName="Customer_ID" 
                                ShowInCustomizationForm="True" VisibleIndex="4" Width="120px">
                                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="พนักงาน" FieldName="EmpName" 
                                ShowInCustomizationForm="True" VisibleIndex="3" Width="150px">
                                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataDateColumn Caption="วันที่สั่งซื้อ" FieldName="Order_Date" 
                                ShowInCustomizationForm="True" VisibleIndex="1" Width="150px">
                                <PropertiesDateEdit DisplayFormatString="dd /MM/yyyy HH:mm:ss" 
                                    EditFormat="DateTime">
                                </PropertiesDateEdit>
                                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            </dx:GridViewDataDateColumn>
                            <dx:GridViewDataDateColumn Caption="วันที่ส่ง" FieldName="Shipped_date" 
                                ShowInCustomizationForm="True" VisibleIndex="2" Width="100px">
                                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            </dx:GridViewDataDateColumn>
                            <dx:GridViewDataTextColumn Caption="รายละเอียด" ShowInCustomizationForm="True" 
                                VisibleIndex="12">
                                <DataItemTemplate>
                                    <table style="width: 100%">
                                        <tr>
                                            <td align="center">
                                                <dx:ASPxButton ID="btOrderDetail" runat="server" Text="รายละเอียด" CommandName="Cmd_Select"  CommandArgument='<%#Eval("Order_Date","{0:dd/MM/yyyy HH:mm:ss.fff}")%>' >  
                                                </dx:ASPxButton>
                                            </td>
                                        </tr>
                                    </table>
                                </DataItemTemplate>
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="ที่อยุ่จัดส่ง" FieldName="Delivery_Address" 
                                ShowInCustomizationForm="True" VisibleIndex="5" Width="100px">
                                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn Caption="ช่องทางสั่งซื้อ" FieldName="Status_BuyName" 
                                ShowInCustomizationForm="True" VisibleIndex="10" Width="70px">
                                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                            </dx:GridViewDataTextColumn>
                              <dx:GridViewDataTextColumn Caption="ตำบล" FieldName="DISTRICT_NAME" 
                                  ShowInCustomizationForm="True" VisibleIndex="6" Width="120px">
                                  <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                              </dx:GridViewDataTextColumn>
                              <dx:GridViewDataTextColumn Caption="อำเภอ" FieldName="AMPHUR_NAME" 
                                  ShowInCustomizationForm="True" VisibleIndex="7" Width="120px">
                                  <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                              </dx:GridViewDataTextColumn>
                              <dx:GridViewDataTextColumn Caption="จังหวัด" FieldName="PROVINCE_NAME" 
                                  ShowInCustomizationForm="True" VisibleIndex="8" Width="120px">
                                  <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                              </dx:GridViewDataTextColumn>
                              <dx:GridViewDataTextColumn Caption="รหัสไปรษณีย์" FieldName="Zipcode" 
                                  ShowInCustomizationForm="True" VisibleIndex="9" Width="70px">
                                  <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                              </dx:GridViewDataTextColumn>
                              <dx:GridViewDataTextColumn Caption="การชำระ" FieldName="Unpaid_Name" 
                                  ShowInCustomizationForm="True" VisibleIndex="11" Width="70px">
                                  <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" />
                              </dx:GridViewDataTextColumn>
                        </Columns>
                        <SettingsPager PageSize="30">
                        </SettingsPager>
                        <Settings ShowFilterRow="True" />
                    </dx:ASPxGridView>
                </asp:Panel>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
